package com.rulin.asp.business.externalservice.service;

import java.util.List;

import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rulin.asp.business.entity.Page;
import com.rulin.asp.business.externalservice.entity.QueryParam;
import com.rulin.asp.business.externalservice.entity.QuesResult;
import com.rulin.asp.business.externalservice.mapper.ExternalMapper;

@Service
public class ExternalService {

	@Autowired
	private ExternalMapper externalMapper;
	
	/**
	 * 分页查询已发放奖励的图书纠错
	 * @param param
	 * @return
	 */
	public Pair<Integer, List<QuesResult>> getQuesListByParam(QueryParam param){
		Integer total = externalMapper.countRewardedQuestionByParam(param);
		Page page = param.getPage();
		page.setTotal(total);
		List<QuesResult> list = externalMapper.selectRewardedQuestionByParam(param);
		return Pair.of(total, list);
	}
	
}
